package com.kang.menu;

import lombok.Getter;

@Getter
public enum PermissionMenu {

    USER_INSERT("/admin/system/sysUser/saveSysUser","bnt.sysUser.add"),
    USER_DELETE("/admin/system/sysUser/deleteSysUser/x","bnt.sysUser.remove"),
    USER_UPDATE("/admin/system/sysUser/updateSysUser","bnt.sysUser.update"),
    USER_SELECT("/admin/system/sysUser/x/x","bnt.sysUser.list"),
    USER_ASSIGN("/admin/system/sysUser/doAssign","bnt.sysUser.assignRole"),

    ROlE_INSERT("/admin/system/sysRole/saveRole","bnt.sysRole.add"),
    ROlE_DELETE("/admin/system/sysRole/remove/x","bnt.sysRole.remove"),
    ROlE_UPDATE("/admin/system/sysRole/updateRole","bnt.sysRole.update"),
    ROlE_SELECT("/admin/system/sysRole/x/x","bnt.sysRole.list"),
    ROlE_ASSIGN("/admin/system/sysMenu/doAssign","bnt.sysRole.assignAuth"),

    MENU_INSERT("/admin/system/sysMenu/saveMenu","bnt.sysMenu.add"),
    MENU_DELETE("/admin/system/sysMenu/deleteMenuById/x","bnt.sysMenu.remove"),
    MENU_UPDATE("/admin/system/sysMenu/updateMenu","bnt.sysMenu.update"),
    MENU_SELECT("/admin/system/sysMenu/findNodes","bnt.sysMenu.list"),

    LOGIN_LOG_SELECT("/admin/system/sysLoginLog/x/x","bnt.sysLoginLog.list"),
    OPER_LOG_SELECT("/admin/system/sysOperLog/x/x","bnt.sysOperLog.list"),



    ;

    private String path;
    private String perssion;

    PermissionMenu(String path, String perssion) {
        this.path = path;
        this.perssion = perssion;
    }

    public static String getPerssionByPath(String path) {
        for (PermissionMenu statusEnum : PermissionMenu.values()) {
            if (path.equals(statusEnum.getPath())) {
                return statusEnum.perssion;
            }
        }
        return null;
    }

}
